# install.packages('reshape2')

library(ggplot2)
library(reshape2)

x <- seq(0, 1, length.out=100)

test_beta <- dbeta(x, shape1=2, shape2=2)

df <- data.frame(
  x=x,
  Beta_2_2 = dbeta(x, shape1=2, shape2=2),
  Beta_2_10 = dbeta(x, shape1=2, shape2=10),
  Beta_5_2 = dbeta(x, shape1=5, shape2=2)
)

df_long <- reshape2::melt(df, id.vars='x',
        variable.name='Distribution', value.name='Density')


ggplot(df_long, aes(x=x, y=Density, color=Distribution)) +
  geom_line(size=1) +
  scale_color_manual(values=c("Beta_2_2"="red", "Beta_2_10"="blue", "Beta_5_2"="green")) +
  labs(
    title="Beta Distribution with Different Shape Parameter",
    x="x",
    y="Density",
    color="Distribution"
  ) +
  theme_minimal()
